package com.dayuanit.dy15.ebook.bookshop.controller;

import com.dayuanit.dy15.ebook.bookshop.dto.CommodityDTO;
import com.dayuanit.dy15.ebook.bookshop.dto.CommodityHomeDTO;
import com.dayuanit.dy15.ebook.bookshop.dto.ResponseDTO;
import com.dayuanit.dy15.ebook.bookshop.redis.RedisService;
import com.dayuanit.dy15.ebook.bookshop.service.CommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class HomeController extends BaseController {

    @Autowired
    @Qualifier("redisServiceTempleImpl")
    private RedisService redisService;

    @Autowired
    private CommodityService commodityService;

    @RequestMapping(value = "/home/book")
    public ResponseDTO loadHomeBook() {

        String homeTop20Book = "home:book:top20";


        List<CommodityHomeDTO> commodityDTOS = commodityService.loadHomeBook();

        return ResponseDTO.sucess(commodityDTOS);
    }
}
